// Hack.java
//
// Informatics 102 Spring 2012
// Code Example
//
// In Java, there is a special kind of interface, denoted as an "@interface"
// rather than an "interface," which is used to define new kinds of
// annotations.  (This syntax, while a little bit obtuse, is not completely
// crazy: when using an annotation, you preface their names with '@' symbols,
// so it makes a certain amount of sense that they are defined as interfaces
// that also begin with an '@' symbol.)
//
// There are a couple of interesting things going on here:
//
// (1) By using "@interface" instead of "interface," we're specifying that
//     we'd like to define a new kind of annotation, called Hack.  This
//     will allow us to put a "@Hack" annotation into our code.
//
// (2) Different kinds of annotations can be placed on different constructs
//     in your program.  For example, you can limit an annotation so that
//     it can only appear on a field, or only on a method.  In this case,
//     we're defining that our annotation can only be used on a method or
//     a type (i.e., a class, an enum, or an interface).  Notice that we
//     say that by putting a special annotation on our @interface, called
//     @Target, which defines what the "target" of the annotation is (i.e.,
//     where we're allowed to put it).  Examples:
//
//         @Target(ElementType.METHOD)
//              indicates that an annotation can be placed on a method
//         @Target(ElementType.FIELD)
//              indicates that an annotation can be placed on a field
//         @Target({ ElementType.LOCAL_VARIABLE, ElementType.PARAMETER })
//              indicates that an annotation can be placed on a local
//              variable or a parameter
//
// (3) Our annotation allows a value to be associated with it.  In
//     particular, we'll allow a string that explains what it is about
//     the annotated code that should be revisited later -- what's so
//     "hackish" about the code.
//
//     Annotations, in general, can allow zero or more named values to be
//     associated with them.  The name "value" is special; it indicates
//     that you can give a value to an annotation without naming it.  So,
//     in our case, we'll have two options for using our annotation:
//
//         @Hack("This is terrible!")
//         @Hack(value = "This is terrible!")
//
//     Either of these will set the value() property of this annotation
//     to the string "This is terrible!"
//
//     As we've specified, there will be an empty string by default, which
//     allows us to use the @Hack annotation without a value, like this:
//
//         @Hack

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;


@Target({ ElementType.METHOD, ElementType.TYPE })
public @interface Hack
{
	String value() default "";
}
